package com.magic.gre.mvp.model;

import com.magic.gre.Api;
import com.magic.gre.mvp.contract.ChooseUnitContract;
import com.noname.lib_base_java.mvp.BaseModelImpl;
import com.noname.lib_base_java.net.RtManager;
import com.noname.lib_base_java.util.L;

import io.reactivex.Observable;
import io.reactivex.Observer;
import okhttp3.ResponseBody;

/**
 * Author: Lmoumou
 * Date: 2019-01-08 10:11
 * 文件名: ChooseUnitModelImpl
 * 描述:
 */
public class ChooseUnitModelImpl extends BaseModelImpl implements ChooseUnitContract.Model {
    @Override
    public void mUnitList(Observer<ResponseBody> observer, String thesaurusId) {
        Observable<ResponseBody> observable = RtManager.getInatance().createApi(Api.class).unitList(thesaurusId);
        doHttp(observer, observable);
    }

    @Override
    public void mResourcesAddress(Observer<ResponseBody> observer,String id) {
        Observable<ResponseBody> observable = RtManager.getInatance().createApi(Api.class).getAddress(id);
        doHttp(observer,observable);
    }

    @Override
    public void mLastUnit(Observer<ResponseBody> observer, String unitId) {
        L.e("mmmmmm","mLastUnit=>id->"+unitId);
        Observable<ResponseBody> observable = RtManager.getInatance().createApi(Api.class).lastUnit(unitId);
        doHttp(observer, observable);
    }
}
